package com.xucan.anno.mainx;

import java.lang.reflect.Method;

public class Calculate {
    @Xucan
    public void add() {

        System.out.println("执行add=====");
    }

    @Xucan
    public void sub() {
        System.out.println("执行sub====");
    }

    public static void main(String[] args) throws Exception{
        Method[] declaredMethods = Calculate.class.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods)
            if (declaredMethod.isAnnotationPresent(Xucan.class)){
                declaredMethod.invoke(new Calculate(), null);
            }

    }
}
